/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package alcatelparser.tags;

import alcatelparser.modules.BuilderFactory;
import alcatelparser.modules.Env;
import alcatelparser.modules.I;

/**
 *
 * @author geniuz
 */
public class BCGTag extends DefaultParserTag
{

    public BCGTag()
    {
    }

    public final void parseTag(int ai[], int i)
    {
        _array = ai;
        _startParsePosition = i;
        if(isFullForm())
            BuilderFactory.getBuilder().writeTagContent(5, 0, getTagPropertiesValue(I.I(5539)), "");
        int j = calculateInnerTagType(ai[i]);
        String s = "";
        boolean flag = false;
        if(isFullForm())
            BuilderFactory.getBuilder().writeTagContent(6, 0, getTagPropertiesValue((new StringBuilder()).append(I.I(5564)).append(j).toString()), "");
        else
            switch(j)
            {
            case 6: // '\006'
            default:
                break;

            case 3: // '\003'
                s = I.I(5585);
                if(isTagChecked(I.I(3216)))
                    flag = true;
                break;

            case 4: // '\004'
                s = I.I(5612);
                if(isTagChecked(I.I(3271)))
                    flag = true;
                break;

            case 5: // '\005'
                s = I.I(5638);
                if(isTagChecked(I.I(3324)))
                    flag = true;
                break;

            case 7: // '\007'
                s = I.I(5658);
                if(isTagChecked(I.I(3387)))
                    flag = true;
                break;

            case 8: // '\b'
                s = I.I(5682);
                if(isTagChecked(I.I(3457)))
                    flag = true;
                break;
            }
        if(j == 0)
        {
            if(isFullForm())
                BuilderFactory.getBuilder().writeTagContent(6, 2, s, toHex(_array[i + 2]));
            else
            if(isTagChecked(I.I(3187)))
                BuilderFactory.getBuilder().writeTagContent(Env.getEnv().isReducedFormParsing() ? 1 : 6, 0, I.I(5712), getHexStringContent(i + 2, _array[i + 1]));
        } else
        if(flag)
            if(Env.getEnv().isFieldsDecoding())
            {
                PhoneNumberDecoratorTag phonenumberdecoratortag = new PhoneNumberDecoratorTag();
                phonenumberdecoratortag.parseTag(_array, i);
            } else
            {
                BuilderFactory.getBuilder().writeTagContent(6, 2, s, toHex(_array[i + 2]));
            }
    }
}
